//
//  CagooPref.m
//  Cagoo
//
//  Created by brice rouanet on 02/02/10.
//  Copyright (c) 2010 __MyCompanyName__. All rights reserved.
//

#import "CagooPref.h"
#import "CagooConfig.h"
#import "CagooController.h"
#include <sys/stat.h>




@implementation CagooPref


- (void) mainViewDidLoad
{
	OSStatus status;
	
	status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef);
    if (status != errAuthorizationSuccess)
        NSLog(@"Error Creating Initial Authorization: %d", status);
	
    AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0};
    AuthorizationRights rights = {1, &right};
    AuthorizationFlags flags = kAuthorizationFlagDefaults |
	kAuthorizationFlagInteractionAllowed |
	kAuthorizationFlagPreAuthorize |
	kAuthorizationFlagExtendRights;
	
    status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL);
    if (status != errAuthorizationSuccess)
	{
		//if rights aren't good, kill the app
        NSLog(@"Copy Rights Unsuccessful: %d", status);
		exit(0);
		
	}
	
	
	
	//status = AuthorizationFree(authorizationRef, kAuthorizationFlagDestroyRights);

}

@end
